import request from '@/config/axios'

// 工程采购计划明细 VO
export interface PurchaseEngineeringDetailVO {
  id: number // 采购详情ID
  planId: number // 采购计划ID
  purchasePlanNo: string // 采购计划编号
  purchaseType: string // 采购类型SERVICE/EQUIPMENT/NGINEERING/MATERIAL/DIRECT/MINOR
  purchaseContent: string // 采购内容(详细)
  estimatedQuantity: number // 预估采购数量
  totalPriceLimit: number // 总价限价(单位：万元，人民币)
  remark: string // 备注
}

// 工程采购计划明细 API
export const PurchaseEngineeringDetailApi = {
  // 查询工程采购计划明细分页
  getPurchaseEngineeringDetailPage: async (params: any) => {
    return await request.get({ url: `/erp/purchase-engineering-detail/page`, params })
  },

  // 查询工程采购计划明细详情
  getPurchaseEngineeringDetail: async (id: number) => {
    return await request.get({ url: `/erp/purchase-engineering-detail/get?id=` + id })
  },

  // 新增工程采购计划明细
  createPurchaseEngineeringDetail: async (data: PurchaseEngineeringDetailVO) => {
    return await request.post({ url: `/erp/purchase-engineering-detail/create`, data })
  },

  // 修改工程采购计划明细
  updatePurchaseEngineeringDetail: async (data: PurchaseEngineeringDetailVO) => {
    return await request.put({ url: `/erp/purchase-engineering-detail/update`, data })
  },

  // 删除工程采购计划明细
  deletePurchaseEngineeringDetail: async (id: number) => {
    return await request.delete({ url: `/erp/purchase-engineering-detail/delete?id=` + id })
  },

  // 导出工程采购计划明细 Excel
  exportPurchaseEngineeringDetail: async (params) => {
    return await request.download({ url: `/erp/purchase-engineering-detail/export-excel`, params })
  },
}